﻿// -------------------------------------------------------------------------
//    @FileName         :    NFMirrorService.cpp
//    @Author           :    Gao.Yi
//    @Date             :    2025-08-29
//    @Email			:    445267987@qq.com
//    @Module           :    NFMirrorService
//    @Desc             :
//
// -------------------------------------------------------------------------

#include "NFMirrorService.h"
#include "NFSession.h"
#include "proto_svr_common.nanopb.h"
#include "proto_svr_onlinesvr.pb.h"
#include "NFServerComm/NFServerCommon/NFIServerMessageModule.h"

int NFMirrorService::MirrorSession(NFSession* pSession, uint64_t roleId, int targetSvrId, int transId)
{
    CHECK_NULL(roleId, pSession);

    proto_ff::Proto_SSZoneMirrorSessionReq req;
    req.set_role_id(roleId);
    pSession->GetClientInfo()->ToPb(req.mutable_client_info());
    pSession->GetConnInfo()->ToPb(req.mutable_conn_info());
    FindModule<NFIServerMessageModule>()->SendTransToLogicServer(NF_ST_LOGIC_SERVER, targetSvrId, E_SS_ZONE_ROLE_MIRROR_SESSION, req, roleId,  transId);

    LOG_INFO(roleId, "Mirror Session to server {}, roleId: {}, transId: {}", NFServerIDUtil::GetBusNameFromBusID(targetSvrId), roleId, transId);
    return 0;
}
